package com.logicwin.RobotTravel;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

public class ModelDialog {
	
	public static void show(Context context, String title, String msg, 
			String positiveText, DialogInterface.OnClickListener positive)
	{
		AlertDialog.Builder builder;

		LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View layout = inflater.inflate(R.layout.model_dialog, null);

		TextView tvTitle = (TextView) layout.findViewById(R.id.model_dialog_textView_title);
		tvTitle.setText((title == null) ? "" : title);
		TextView tvMsg = (TextView) layout.findViewById(R.id.model_dialog_textView_msg);
		tvMsg.setText(msg);

		builder = new AlertDialog.Builder(context);
		builder.setView(layout);
		if(positive != null && positiveText != null){
			builder.setPositiveButton(positiveText, positive);
		}		
		builder.create().show();
	}
}
